<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="connDbBean" scope="page" class="com.util.db"/>
<%@ page isELIgnored="false" %>

<%
	if((String)request.getSession().getAttribute("username")==null || (String)request.getSession().getAttribute("username")=="")
	{
		out.print("<script>javascript:alert('对不起，请您先登陆！');history.back();</script>");
		return;
	}







	else
	{
		String id=request.getParameter("id");
		String biao=request.getParameter("biao");
		String ziduan=request.getParameter("ziduan");
		String biaoj=request.getParameter("biaoj");


		int ss=0;
		String sql2="select * from  shoucangjilu where username='"+request.getSession().getAttribute("username")+"'  and xwid='"+id+"' and  biao='"+biao+"'  ";
//		connDbBean.nmm = "2005";

		ResultSet RS_resultbht=connDbBean.executeQuery(sql2);
		while(RS_resultbht.next()){

			ss++;

			if (ss>=1)





			{
				out.print("<script>alert('您已经收藏，请勿重复收藏！');location.href='sy.jsp';</script>");
				return;
			}
		}


		/*这里判断表写入数据*/
		/*	if (biao.equals("tukuxinxi")||biao.equals("zuopinxinxi")) { 

 String sql2="";
sql2="update '"+biao+"' set shoucangliang=shoucangliang+1  where xwid='"+id+"' and  biao='"+biao+"'  ";
	 

 } */




		String sql="insert into shoucangjilu(username,xwid,ziduan,biao,biaoj) values('"+request.getSession().getAttribute("username")+"','"+id+"','"+ziduan+"','"+biao+"','"+biaoj+"')";
		connDbBean.hsgexecute(sql);
		out.print("<script>alert('收藏成功!!');location.href='"+request.getHeader("Referer")+"';</script>");
	}
%>
